package process;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;


public class SendFileTCP {
	
	
	
	//private String m_host = "192.168.0.100";
	private int i_port = 8080;
	
	//private String m_Path = "/sdcard";
//	private String m_filename = "b.ppt";
	private int size = 1400;
	private String m_Start = "SendFileName";
	private String m_End = "Kết thúc";
	private InputStream is;
	private FileInputStream fis;
	private BufferedInputStream bis;
	
	
	public String SendUsingTCP(String m_Path ,String m_filename,String m_host)
	{
		String thongbao ="";
		SendAllFile send = new SendAllFile();
		int kq = send.SendInfoStartSend(m_host, i_port, m_Start);
		int kq1 = send.sendfilename(m_host, i_port, m_filename);
		int kq2 = send.SenContentFile(m_Path, m_filename, m_host, i_port);
		//int kq3 = send.sendInfoEndSend(m_host, i_port, m_End);
		
		if(kq1==1 && kq2==1)
		{
			thongbao = "successful";
		}
		else
		{
			thongbao = "unsuccessful";
		}
		
		
		
		return thongbao;
		
		
	}

}
